Skip to content

feat: Allow files in wheels to be installed to directories#3233

Merged
rickeylev merged 5 commits intobazel-contrib:mainfrom
Ahajha:ahajha/wheel-dir
Mar 15, 2026
Merged

feat: Allow files in wheels to be installed to directories#3233
rickeylev merged 5 commits intobazel-contrib:mainfrom
Ahajha:ahajha/wheel-dir

Conversation

@Ahajha
Copy link
Contributor

@Ahajha Ahajha commented Sep 3, 2025

When specifying data_files in py_wheel, allow just the directory to be specified (with a trailing slash), in which case it will use the existing filename. This avoids duplicating (potentially platform-specific) names. Additionally, targets with multiple files can be installed as a group to a folder, with the same filename-preserving behavior. In general I think this is a better starting point, as I imagine most of the time users would want to preserve the names.

Before, this would result in the file simply not being installed, so this only changes already-broken behavior.

@Ahajha Ahajha marked this pull request as ready for review November 19, 2025 16:03
@Ahajha
Copy link
Contributor Author

Ahajha commented Nov 19, 2025

Sorry for the long pause while this sat here, been a busy few months but I got some time to come back to this. Still need to add a few tests + update docs, but the core functionality is ready.

@Ahajha
Copy link
Contributor Author

Ahajha commented Mar 13, 2026

@aignas Can I get a review on this? We've been using it internally for a while and it's working well for us. Happy to add tests/docs, etc. if you'd like.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch, could you please add an example in the wheel examples folder please? Then a changelog note advertising the functionality and updating the docstring of the affected py_wheel. :)

@Ahajha
Copy link
Contributor Author

Ahajha commented Mar 14, 2026

Yup, sure thing!

Ahajha and others added 2 commits March 14, 2026 23:19
When specifying `data_files` in `py_wheel`, allow just the directory to be specified (with a trailing slash), in which case it will use the file's name. This avoids duplicating (potentially platform-specific) names.
@Ahajha Ahajha force-pushed the ahajha/wheel-dir branch from f5faa54 to ecdd24d Compare March 15, 2026 03:19
@Ahajha Ahajha force-pushed the ahajha/wheel-dir branch from ecdd24d to 9858340 Compare March 15, 2026 03:21
@Ahajha
Copy link
Contributor Author

Ahajha commented Mar 15, 2026

Done, done, and done!

@rickeylev rickeylev enabled auto-merge March 15, 2026 03:55
Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Ignas's comments have been address, so approving and enqueuing

@rickeylev rickeylev added this pull request to the merge queue Mar 15, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 15, 2026
@Ahajha
Copy link
Contributor Author

Ahajha commented Mar 15, 2026

Huh, failures look unrelated to my changes (as far as I can tell, happy to be told otherwise). What's the policy when this happens?

@rickeylev rickeylev added this pull request to the merge queue Mar 15, 2026
@rickeylev
Copy link
Collaborator

Bazel ci and/or GitHub has been flaky with network reliability lately, so we just requeue and retry

Merged via the queue into bazel-contrib:main with commit 77a89a6 Mar 15, 2026
4 checks passed
@Ahajha Ahajha deleted the ahajha/wheel-dir branch March 15, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants